home *** CD-ROM | disk | FTP | other *** search
- #include "MultiMonitorDoc.h"
-
- #include <PP_DebugMacros.h>
- #include <PP_KeyCodes.h>
-
- #include <LFile.h>
- #include <LPlaceHolder.h>
- #include <LCheckBoxGroupBox.h>
- #include <LCheckBox.h>
- #include <LPrintout.h>
- #include <LString.h>
- #include <LSlider.h>
- #include <LWindow.h>
- #include <PP_Messages.h>
- #include <UMemoryMgr.h>
- #include <UResourceMgr.h>
- #include <UWindows.h>
-
- #include <AERegistry.h>
-
- #include "AppConstants.h"
- #include "MultiMonitorController.h"
-
- const PaneIDT kPaneID_Enable = 'MMEn';
- const PaneIDT kPaneID_Magnify = 'Mgnf';
-
- const MessageT msg_Enable = 'MMEn';
- const MessageT msg_Magnify = 'Mgnf';
-
-
- // ---------------------------------------------------------------------------------
- // • MultiMonitorDoc [public]
- // ---------------------------------------------------------------------------------
- // Constructor
-
- MultiMonitorDoc::MultiMonitorDoc(
- LCommander * inSuper)
- : LSingleDoc(inSuper)
- {
- // Create window for our document.
- mWindow = LWindow::CreateWindow(PPob_TextWindow, this );
- ValidateObject_(mWindow);
-
- LPane * newPane;
-
- newPane = mWindow->FindPaneByID(kPaneID_Enable);
- ValidateObject_(newPane);
- static_cast<LCheckBoxGroupBox *>(newPane)->AddListener(this);
-
- newPane = mWindow->FindPaneByID(kPaneID_Magnify);
- ValidateObject_(newPane);
- static_cast<LCheckBox *>(newPane)->AddListener(this);
-
- // Make the window visible.
- mWindow->Show();
- }
-
-
- // ---------------------------------------------------------------------------------
- // • ~MultiMonitorDoc [public, virtual]
- // ---------------------------------------------------------------------------------
- // Destructor
-
- MultiMonitorDoc::~MultiMonitorDoc()
- {
- MultiMonitorController & mmController = MultiMonitorController::GetInstance();
-
- // Disable the multi-monitor controller before
- // going away.
- mmController.Disable();
-
- TakeOffDuty();
- }
-
-
- // ---------------------------------------------------------------------------
- // • FindCommandStatus [public, virtual]
- // ---------------------------------------------------------------------------
- // Override provided here for convenience.
-
- void
- MultiMonitorDoc::FindCommandStatus(
- CommandT inCommand,
- Boolean& outEnabled,
- Boolean& outUsesMark,
- UInt16& outMark,
- Str255 outName)
- {
- LSingleDoc::FindCommandStatus(inCommand, outEnabled, outUsesMark, outMark, outName);
- }
-
-
- // ---------------------------------------------------------------------------
- // • ListenToMessage [public, virtual]
- // ---------------------------------------------------------------------------
-
- void
- MultiMonitorDoc::ListenToMessage(
- MessageT inMessage,
- void* ioParam)
- {
- SInt32 controlValue = *reinterpret_cast<SInt32 *>(ioParam);
- MultiMonitorController & mmController = MultiMonitorController::GetInstance();
-
- switch (inMessage)
- {
- case msg_Enable:
- if (controlValue == 0)
- mmController.Disable();
- else
- mmController.Enable();
- break;
-
- case msg_Magnify:
- mmController.EnableMagnify(controlValue);
- break;
- }
- }
-
-
- // ---------------------------------------------------------------------------
- // • ObeyCommand [public, virtual]
- // ---------------------------------------------------------------------------
- // Override provided here for convenience.
-
- Boolean
- MultiMonitorDoc::ObeyCommand(
- CommandT inCommand,
- void* ioParam)
- {
- Boolean cmdHandled = LSingleDoc::ObeyCommand(inCommand, ioParam);
-
- return cmdHandled;
- }
-
-
-